home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBASE102.ARJ / LSEQ_.H < prev    next >
Text File  |  1991-09-23  |  2KB  |  89 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /*man---------------------------------------------------------------------------
  5. NAME
  6.      lseq_.h - private header file for lseq library
  7.  
  8. SYNOPSIS
  9.      #include "lseq_.h"
  10.  
  11. DESCRIPTION
  12.      This is a private header file included by the lseq library
  13.      modules.
  14.  
  15. ------------------------------------------------------------------------------*/
  16. #ifndef H_LSEQ_            /* prevent multiple includes */
  17. #define H_LSEQ_
  18.  
  19. /* #ident    "@(#)lseq_.h    1.5 - 91/09/23" */
  20.  
  21. #include <ansi.h>
  22.  
  23. /*#define DEBUG        /* switch to enable debugging for lseq library */
  24.  
  25. #include <bool.h>
  26.  
  27. /* local headers */
  28. #include "lseq.h"
  29.  
  30. /* tables */
  31. extern lseq_t lsb[LSOPEN_MAX];    /* lseq control structure table declaration */
  32.  
  33. /* lshdr_t bit flags */
  34. #define LSHMOD          (01)    /* lseq file being modified */
  35.  
  36. /* lseq_t bit flags */
  37. #define LSOPEN          (03)    /* open status bits */
  38. #define LSREAD          (01)    /* lseq is open for reading */
  39. #define LSWRITE          (02)    /* lseq is open for writing */
  40. #define LSLOCKS         (030)    /* lock status bits */
  41. #define LSRDLCK         (010)    /* lseq is read locked */
  42. #define LSWRLCK         (020)    /* lseq is write locked */
  43. #define LSERR        (0100)    /* error has occurred on this lseq */
  44.  
  45. /* function declarations */
  46. #ifdef AC_PROTO
  47. int        ls_alloc(lseq_t *lsp);
  48. void        ls_free(lseq_t *lsp);
  49. bool        ls_valid(lseq_t *lsp);
  50.  
  51. lsrec_t *    ls_rcalloc(lseq_t *lsp);
  52. int        ls_rccopy(lseq_t *lsp, lsrec_t *tlsrp, const lsrec_t *slsrp);
  53. void        ls_rcfree(lsrec_t *lsrp);
  54. int        ls_rcget(lseq_t *lsp, lspos_t lspos, lsrec_t *lsrp);
  55. void        ls_rcinit(lseq_t *lsp, lsrec_t *lsrp);
  56. int        ls_rcput(lseq_t *lsp, lspos_t lspos, const lsrec_t *lsrp);
  57. int        ls_rcputf(lseq_t *lsp, lspos_t lspos, size_t offset,
  58.             const void *buf, size_t bufsize);
  59. #else
  60. int        ls_alloc();
  61. void        ls_free();
  62. bool        ls_valid();
  63. lsrec_t *    ls_rcalloc();
  64. int        ls_rccopy();
  65. void        ls_rcfree();
  66. int        ls_rcget();
  67. void        ls_rcinit();
  68. int        ls_rcput();
  69. int        ls_rcputf();
  70. #endif    /* #ifdef AC_PROTO */
  71.  
  72. /* macros */
  73. #define    ls_blksize(LSP)    (offsetof(lsrec_t, recbuf) + (LSP)->lshdr.recsize)
  74.  
  75. /* lseq open types */
  76. #define LS_READ    ("r")
  77. #define LS_RDWR    ("r+")
  78.  
  79. #ifdef DEBUG
  80. #define    LSEPRINT {                            \
  81.     fprintf(stderr, "lseq error line %d of %s. errno = %d.\n",    \
  82.         __LINE__, __FILE__, errno);                \
  83. }
  84. #else
  85. #define LSEPRINT
  86. #endif
  87.  
  88. #endif        /* #ifndef H_LSEQ_ */
  89.